<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <div id="course_class_signup_totaltb">
        <form id="course_class_signup_totalForm" class="m10">
             学期：<select class="easyui-combobox" id="termId" name="termId" data-options="width:120,panelHeight:'auto',value:'', editable:false,textField:'学期名称',valueField:'ID',url:'/compent/Util/termList',onLoadSuccess: function(param) {
                $('#termId').combobox('setValue',param[0].ID);
             }"></select>
             年级：<select id="gradeId" name="gradeId" class="easyui-combobox" data-options="width:80,panelHeight:'auto',url:'/compent/Util/gradeNameList',onLoadSuccess: function(param) {
                $('#gradeId').combobox('setValue',param[0].value);
                queryOk('course_class_signup_total');
             }"></select>
             <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="queryOk('course_class_signup_total')">查询</a>
             <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-clear'" onclick="resetForm('course_class_signup_total')">重置</a>
             <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-save'" onclick="zoutExcel()">导出为EXCEL</a>
            </div>
        </form>
    </div>
    <table id="course_class_signup_totaldg"></table>
    <script type="text/javascript">
        var url = "/kccsCourse/course_class_signup_total";
        $(function(){
            
        })
        function queryOk(cf){
            var termId = $('#termId').combobox('getValue');
            var gradeId = $('#gradeId').combobox('getValue');
            var termName = $('#termId').combobox('getText');
            var termKey = termName.substr(termName,4);
            var grade = getGrade(termKey,gradeId);
            $.post(url+"/getHeader",{grade: grade},function(data){
                var txArr=data.split(",");
                var zdArr=[];   
                var txshu = txArr.length;
                var fieldArray = [];
                for(var i=0;i<=txshu-1;i++){
                    title=txArr[i];
                    zdArr.push({field:title,title:title})
                }
                $("#"+cf+"dg").datagrid({
                        url: url + "/pageQuery",
                        toolbar: '#'+cf+'tb',
                        fit : true,
                        fitColumns : true,
                        border : true,
                        pagination : false,
                        autoRowHeight : 140,
                        nowrap : true,
                        striped : true,
                        singleSelect: true,
                        rownumbers : true,
                        collapsible: true,
                        columns: [zdArr],
                        queryParams: {
                            termId:termId,
                            grade:grade
                        }
                });
            })
        }
        function zoutExcel() {
            var termId = $('#termId').combobox('getValue');
            var gradeId = $('#gradeId').combobox('getValue');
            var termName = $('#termId').combobox('getText');
            var termKey = termName.substr(termName,4);
            var grade = getGrade(termKey,gradeId);
            window.location.href = url+"/exportExcel.html?termId=" + termId + "&grade=" + grade;
        }
    </script>

</body>
</html>